package com.houcine.dao;

import java.util.List;

import javax.persistence.Query;

import com.houcine.entity.Book;

public class BookDAO extends GenericJPADAO<Book, Integer> {
	
	@SuppressWarnings("unchecked")
	public List<Book> list(int page, int size) {
	    Query query = this.em.createQuery("from Book order by title");
	    query.setFirstResult((page - 1) * size);
	    query.setMaxResults(size);
	    return query.getResultList();
	}
}
